import { listAll } from '@/api/departMent.js'

const departMents = {
  state: {
    departMents: null,
  },

  mutations: {
    SET_DEPART: (state, departMents) => {
      state.departMents = departMents
    },
  },

  actions: {
    // 所有部门
    GetAllDepartMent({ commit }) {
      return new Promise((resolve, reject) => {
        listAll().then(res => {
          commit('SET_DEPART', res?.data?.data)
          resolve()
        }).catch(error => {
          reject(error)
        })
      })
    },
  }
}

export default departMents
